#include<iostream>
#include<string>
#include<vector>
using namespace std;

class Solution {
public:
	vector<int> plusOne(vector<int>& digits) {
		int right = digits.size() - 1;
		while (right >= 0) {
			int num = digits[right];
			if (num <= 8) {
				digits[right] += 1;
				break;
			}
			else {
				digits[right] = 0;
				right--;
			}
		}
		if (digits[0] == 0) digits.insert(digits.begin(), 1);
		return digits;
	}
};

int main() {
	vector<int> arr = { 0 };
	Solution s;
	s.plusOne(arr);
}